package com.example.websocket;

import com.example.websocket.ws.ChatEndPoint;
import com.example.websocket.ws.Group;
import com.example.websocket.ws.PtoP;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;

@MapperScan("com.example.websocket.mapper")
@SpringBootApplication
public class WebsocketApplication {

	public static void main(String[] args) {
//		SpringApplication.run(WebsocketApplication.class, args);

		SpringApplication springApplication = new SpringApplication(WebsocketApplication.class);
		ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
		//解决WebSocket不能注入的问题
		ChatEndPoint.setApplicationContext(configurableApplicationContext);
		PtoP.setApplicationContext(configurableApplicationContext);
		Group.setApplicationContext(configurableApplicationContext);

	}
	


}
